return do_sysctl(xch, &sysctl);
}
-int xc_lockprof_control(xc_interface *xch,
- uint32_t opcode,
+int xc_lockprof_reset(xc_interface *xch)
+{
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_lockprof_op;
+ sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_reset;
+ set_xen_guest_handle(sysctl.u.lockprof_op.data, NULL);
+
+ return do_sysctl(xch, &sysctl);
+}
+
+int xc_lockprof_query_number(xc_interface *xch,
+ uint32_t *n_elems)
+{
+ int rc;
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_lockprof_op;
+ sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_query;
+ set_xen_guest_handle(sysctl.u.lockprof_op.data, NULL);
+
+ rc = do_sysctl(xch, &sysctl);
+
+ *n_elems = sysctl.u.lockprof_op.nr_elem;
+
+ return rc;
+}
+
+int xc_lockprof_query(xc_interface *xch,
uint32_t *n_elems,
uint64_t *time,
xc_lockprof_data_t *data)
DECLARE_SYSCTL;
sysctl.cmd = XEN_SYSCTL_lockprof_op;
- sysctl.u.lockprof_op.cmd = opcode;
- sysctl.u.lockprof_op.max_elem = n_elems ? *n_elems : 0;
+ sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_query;
+ sysctl.u.lockprof_op.max_elem = *n_elems;
set_xen_guest_handle(sysctl.u.lockprof_op.data, data);
rc = do_sysctl(xch, &sysctl);
- if (n_elems)
- *n_elems = sysctl.u.lockprof_op.nr_elem;
- if (time)
- *time = sysctl.u.lockprof_op.time;
+ *n_elems = sysctl.u.lockprof_op.nr_elem;
return rc;
}
xc_perfc_val_t *val);
typedef xen_sysctl_lockprof_data_t xc_lockprof_data_t;
+int xc_lockprof_reset(xc_interface *xch);
+int xc_lockprof_query_number(xc_interface *xch,
+ uint32_t *n_elems);
/* IMPORTANT: The caller is responsible for mlock()'ing the @data array. */
-int xc_lockprof_control(xc_interface *xch,
- uint32_t opcode,
- uint32_t *n_elems,
- uint64_t *time,
- xc_lockprof_data_t *data);
+int xc_lockprof_query(xc_interface *xch,
+ uint32_t *n_elems,
+ uint64_t *time,
+ xc_lockprof_data_t *data);
/**
* Memory maps a range within one domain to a local address range. Mappings
if ( argc > 1 )
{
- if ( xc_lockprof_control(xc_handle, XEN_SYSCTL_LOCKPROF_reset, NULL,
- NULL, NULL) != 0 )
+ if ( xc_lockprof_reset(xc_handle) != 0 )
{
fprintf(stderr, "Error reseting profile data: %d (%s)\n",
errno, strerror(errno));
}
n = 0;
- if ( xc_lockprof_control(xc_handle, XEN_SYSCTL_LOCKPROF_query, &n,
- NULL, NULL) != 0 )
+ if ( xc_lockprof_query_number(xc_handle, &n) != 0 )
{
fprintf(stderr, "Error getting number of profile records: %d (%s)\n",
errno, strerror(errno));
}
i = n;
- if ( xc_lockprof_control(xc_handle, XEN_SYSCTL_LOCKPROF_query, &i,
- &time, data) != 0 )
+ if ( xc_lockprof_query(xc_handle, &i, &time, data) != 0 )
{
fprintf(stderr, "Error getting profile records: %d (%s)\n",
errno, strerror(errno));